package org.example.game.history;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/05/11 22:41
 */
public class Solution100299 {

    public static void main(String[] args) {
        Solution100299 solution100299 = new Solution100299();
        int[][] grid = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}};

        System.out.println(solution100299.satisfiesConditions(grid));
    }

    public boolean satisfiesConditions(int[][] grid) {

        if(grid.length == 0){
            return true;
        }

        if(grid.length == 1 && grid[0].length == 1){
            return true;
        }

        for(int i=0;i<grid.length;i++){
            for(int j=0;j<grid[i].length;j++){
                if(j+1 < grid[i].length){
                    if(grid[i][j] == grid[i][j + 1]){
                        return false;
                    }
                }

                if(i+1 < grid.length){
                    if(grid[i][j] != grid[i + 1][j]){
                        return false;
                    }
                }

            }
        }

        return true;
    }

}
